const HTTP = uni.$u.http
/**
 * http请求
 * {get, post, put, delete, upload}
 */
export default {
  /**
	 * @function get请求
	 * @param {String} url 请求路径
	 * @param {Object} params 请求参数
	 * @param {Object} config 请求配置项
	 * @return {Promise}
	 */
  get: (url, params = {}, config = {}) => HTTP.get(url, { params, ...config }),

  /**
	 * @function post请求
	 * @param {String} url 请求路径
	 * @param {Object} data 请求参数
	 * @param {Object} config 请求配置项
	 * @return {Promise}
	 */
  post: (url, data = {}, config = {}) => HTTP.post(url, data, config),

  /**
	 * @function put请求
	 * @param {String} url 请求路径
	 * @param {Object} data 请求参数
	 * @param {Object} config 请求配置项
	 * @return {Promise}
	 */
  put: (url, data = {}, config = {}) => HTTP.put(url, data, config),

  /**
	 * @function delete请求
	 * @param {String} url 请求路径
	 * @param {Object} data 请求参数
	 * @param {Object} config 请求配置项
	 * @return {Promise}
	 */
  delete: (url, data = {}, config = {}) => HTTP.delete(url, data, config),

  /**
	 * @function upload请求
	 * @param {String} url 请求路径
	 * @param {Object} config 请求配置项
	 * @return {Promise}
	 */
  upload: (url, config = {}) => HTTP.upload(url, config)
}
